package com.zzh.oauth.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.endpoint.FrameworkEndpoint;
import org.springframework.security.oauth2.provider.token.ConsumerTokenServices;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@FrameworkEndpoint
@RequestMapping("/oauth")
public class OauthController {
    @Autowired
    private ConsumerTokenServices tokenServices;

    @GetMapping("logout")
    public String revokeToken(String accessToken){
        if (tokenServices.revokeToken(accessToken)){
            return "注销成功";
        }else{
            return "注销失败";
        }

    }


}
